<%'option explicit%>
<%
'强制浏览器重新访问服务器下载页面，而不是从缓存读取页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>

<!-- #include file="inc/inc_public.asp" -->

<%
sql="select * from config"
set rs_config=conn.execute(sql)
Global_Name=rs_config("dianming")

rs_config.close()
set rs_config = nothing

if request("action")="" Then

%>

<HTML>
<HEAD>
<TITLE><%=Global_Name%> - 系统登陆</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<!-- #include file="inc/js.asp" -->

<SCRIPT language=JavaScript type=text/JavaScript>
	nereidFadeObjects = new Object();
	nereidFadeTimers = new Object();
	function nereidFade(object, destOp, rate, delta){
	if (!document.all)
		return
		if (object != "[object]"){ 
			setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
			return;
		}
		clearTimeout(nereidFadeTimers[object.sourceIndex]);
		diff = destOp-object.filters.alpha.opacity;
		direction = 1;
		if (object.filters.alpha.opacity > destOp){
			direction = -1;
		}
		delta=Math.min(direction*diff,delta);
		object.filters.alpha.opacity+=direction*delta;
		if (object.filters.alpha.opacity != destOp){
			nereidFadeObjects[object.sourceIndex]=object;
			nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
		}
	}
	</SCRIPT>

<STYLE>
body {font-family: "宋体";font-size: 12px;text-decoration: none;}
td {font-size: 12px;color: white;text-decoration: none;line-height: 18px;font-family: "宋体";}
.S1{
font-family: "宋体"; 
font-weight: bold; 
color: #ffffff; 
font-size:16px;
text-decoration: none}
</STYLE>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle">
<table width="646" height="425" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td colspan="2"><img src="images/login_01.gif" width="646" height="85"></td>
	</tr>
	<tr>
		<td width="322"><img src="images/login_02.gif" width="323" height="340"></td>
	  <td width="324" align="center" valign="top" background="images/login_03.gif"><br>
		         <FORM ACTION="index.asp?action=login" METHOD="post" name="loginform">
		      <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="87" height="30" align="right">登录名：</td>
            <td valign="middle"><input type="text" name="username" tabindex="1" style="width:160px;"></td>
            </tr>
          <tr>
            <td height="30" align="right">密　码：</td>
            <td><INPUT name="pwd"  type="password" tabindex="2" style="width:160px;"></td>
          </tr>
          <tr>
            <td height="30" align="right">验证码：</td>
            <td height="30"><input type=text name="verifycode" maxLength=6 size="6" tabindex="3" class="textbox">
              <font color=red><-请在验证码框输入</font> <IMG style="cursor:hand;" src="inc/verifycode.asp?n=<%=Timer%>" onClick="this.src=this.src;" align="absmiddle">&nbsp;</td>
          </tr>
          <tr>
            <td height="50" colspan="2" align="center"><input onMouseOver=nereidFade(this,100,10,5)  style="FILTER:alpha(opacity=50)" onMouseOut=nereidFade(this,50,10,5) src="images/dl.gif"  type="image" tabindex="5" name="enter" border="0" onClick="return checkform()">            </td>
            </tr>
          <tr>
            <td colspan="2"></td>
          </tr>
        </table>
		</form><hr size=1 color='#efefef' width='80%' align='center'>
		<span style="text-align:center;">Copyright &copy; 2010 Powered By Jakey</span></td>
	</tr>
</table>
</td></tr></table>
<script language=javascript>
<!--
function document.onreadystatechange()
{  var app=navigator.appName;
  var verstr=navigator.appVersion;
  if(app.indexOf('Netscape') != -1) {
    alert('友情提示：\n    您使用的是Netscape浏览器，可能会导致无法使用后台的部分功能。建议您使用 IE6.0 或以上版本。');
  } else if(app.indexOf('Microsoft') != -1) {
    if (verstr.indexOf('MSIE 3.0')!=-1 || verstr.indexOf('MSIE 4.0') != -1 || verstr.indexOf('MSIE 5.0') != -1 || verstr.indexOf('MSIE 5.1') != -1)
      alert('友情提示：\n    您的浏览器版本太低，可能会导致无法使用后台的部分功能。建议您使用 IE6.0 或以上版本。');
  }
  document.loginform.username.focus();
}
function checkform() {
  if(loginform.username.value == '') {
    alert('请输入管理账号！');
    loginform.username.focus();
    return false;
  }
  if(loginform.pwd.value == '') {
    alert('请输入密码！');
    loginform.pwd.focus();
    return false;
  }
  if (loginform.verifycode.value == '') {
    alert ('请输入验证码！');
    loginform.verifycode.focus();
    return false;
  }
}
//-->
</script>
</html>

<%
else
'' 登录验证过程

nowusername=request.form("username")
nowpwd=request.form("pwd")

if Trim(Request.Form("Verifycode"))<>Trim(Session("Verifycode")) then 
	Call ShowError(0, -1, "您输入的后台管理认证码不对，请重新输入！")
	Call closedb()
	Response.end
end if

userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If userip = "" Then
	userip = Request.ServerVariables("REMOTE_ADDR")
end if

sql="select * from login where (username='"&nowusername&"' and pwd='"&_
	md5(nowpwd)&"') or (bianhao='"&nowusername&"' and pwd='"&md5(nowpwd)&"')"
set rs=conn.execute(sql)

if rs.eof then
	conn.execute("insert into rizi(username,class,address) values('"&nowusername&"','登陆失败','"&userip&"')")
	Call ShowError(0, -1, "登录名称或密码错误！")
	Call closedb()
	Response.end
end if
conn.execute("insert into rizi(username,class,address) values('"&nowusername&"','登陆成功','"&userip&"')")
set rs_zu=conn.execute("select * from zu_login where id="&rs("id_zu"))

if rs_zu.eof=false then
	session("shiwei_zu")=rs_zu("zu")
	session("shiwei_zu_type")=CStr(rs_zu("zu_type"))
else
	session("shiwei_zu")=""
	' 0 - 普通组
	session("shiwei_zu_type")="0"
end If

'用户姓名
session("shiwei_username")=rs("username")
session("shiwei_name")=rs("username")
'用户分组
session("shiwei_id_zu")=rs("id_zu")
'用户ID
session("shiwei_id")=rs("id")
'用户权限
session("Rights") = rs("quanxian")
response.redirect "main.asp"

end if
%>